<?php
class sscls_CategoryController extends sscls_Controller
{
    function __construct()
    {
        $this->view='article';
    }
	
	function view()
	{
		$model=$this->getModel();
		$values['cats']=$model->getCategoryList();
		$this->layout='categories';
		$this->view='category';
		$this->display($values);
		return;
	}
    function add()
	{
		$model=$this->getModel();
		$id=sscls_Request::getRequest('id');
		$vals['cats']=$model->getCategories();
		$vals['item']=$model->getById($id);
		$this->layout='add';
		$this->view='category';
		$this->display($vals);
		}
	function proccessadd()
	{
		$post=sscls_Request::get('post');
		$post['id']=sscls_Request::getRequest('id');
		
		$model=$this->getModel();
		
		if($model->store1($post,'categories'))
		{
			$this->setRedirec('index.php?c=category');
			return;
		}
		$this->setRedirec('index.php?c=article&t=add');
		return;
	}
	
	function remove()
	{
		$cid=$_POST['cid'];
		$model=$this->getModel();
		$model->remove($cid);
		$this->setRedirec('index.php?c=category');
		return;
	}
    
}
 
?>